<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="jquery-3.7.1.min.js"></script>
</head>
<body>

<ul>
    <li>abc</li>
    <li class="active">xyz</li>
    <li><span>china</span></li>
    <li class="active">fujian</li>
</ul>

<script>

    console.log($("li:has(span)").length);


    var str = "   Hello, World!   ";

    // console.log($.trim(str));

    var obj1 = {a: 1, b: 2};
    var obj2 = {b: 3, c: 4};

    var arr = [1, 2, 3, 4, 5, 6, 7, 8];


    let grep = $.grep(arr, function (e) {
        return e % 2 === 0;
    });

    // console.log(grep);


    // console.log($.inArray(1, arr));


    var jsonString = '{"name": "Alice", "age": 30}';
    var jsonObj = $.parseJSON(jsonString);
    // console.log(jsonObj); // 输出 "Alice"
    // var mergedObj = $.extend({}, obj1, obj2);
    // console.log(mergedObj)

    // console.log($('ul li').filter('.active').length);
    // console.log($('ul li').not('.active').length);

    // console.log($("ul li").has('span').length);
    // console.log();

    // console.log($('ul li :has(span)'));


    // console.log($('ul li').first().html());
    // console.log($('ul li').last().html());
    // console.log($('ul li').eq(1).html());
    // console.log($('ul li').gt(1).length);
    // console.log($('ul li').eq(1).html());
</script>

</body>
</html>